#ifndef MESHASSEMBLYDIALOG_H
#define MESHASSEMBLYDIALOG_H

#include "GUIMeshDialogAPI.h"
//#include "GUIWidget/GUIDialogBase.h"
#include "FITK_Kernel/FITKCore/FITKAbstractGUI.h"

class QVBoxLayout;
class vtkPoints;
class vtkUnstructuredGrid;
class vtkDataSet;

namespace Ui {
    class MeshAssemblyDialog;
}

namespace Interface {
    class FITKUnstructuredMeshVTK;
    class FITKMeshVTKManagerFASTSIM;
}

namespace EventOper {
    class ParaWidgetInterfaceOperator;
}

namespace GUI
{
    /**
     * @brief 网格装配界面
     * @author liuyun
     * @date 2025-01-10
     */
    class GUIMeshDialogAPI MeshAssemblyDialog :public Core::FITKWidget
    {
        Q_OBJECT;
    public:
        /**
         * @brief Construct a new Mesh Geo Widget object
         * @param[i]  oper           操作器对象
         * @param[i]  obj            网格尺寸对象
         * @author liuyun
         * @date 2025-01-10
         */
        MeshAssemblyDialog(EventOper::ParaWidgetInterfaceOperator * oper, Interface::FITKUnstructuredMeshVTK* obj);
        /**
         * @brief Destroy the Mesh Geo Widget object
         * @author liuyun
         * @date 2025-01-10
         */
        ~MeshAssemblyDialog();
        /**
         * @brief 初始化界面
         * @author liuyun
         * @date 2025-01-10
         */
        void init();

    signals:
        void sigAssemblyFinish();

    private:
        /**
         * @brief 无铆连接自动装配
         * @author liuyun
         * @date 2025-01-10
         */
        bool AutoInstallset_Clinching();
        /**
         * @brief 单色币自动装配
         * @author liuyun
         * @date 2025-01-10
         */
        bool AutoInstallset_SingleCoin();
        /**
         * @brief 双色币自动装配
         * @author liuyun
         * @date 2025-01-10
         */
        bool AutoInstallset_TwoCoins();
        /**
         * @brief 获取网格的中心点坐标
         * @author liuyun
         * @date 2025-01-10
         */
        void genMeshCenterPoint(double* xyzMax,double* xyzMin,double* MeshXYZ);
        /**
         * @brief 生成网格xyz方向的最大、最小坐标
         * @author liuyun
         * @date 2025-01-10
         */
        void genMeshMaxMinCoordinate(int meshpointnumber,vtkPoints* points,double* xyzMax,double* xyzMin);
        /**
         * @brief 网格通用移动器
         * @author liuyun
         * @date 2025-01-10
         */
        void moveMesh(int meshpointnumber,vtkPoints* points,vtkUnstructuredGrid* ung,
                      double x,double y,double z);

    private slots:
        void MovingMould();
        void AutoInstallset();

    private:
        /**
         * @brief 操作器对象
         * @author liuyun
         * @date 2025-01-10
         */
        EventOper::ParaWidgetInterfaceOperator* _oper = nullptr;
        /**
         * @brief 网格尺寸对象
         * @author liuyun
         * @date 2025-01-10
         */
        Interface::FITKUnstructuredMeshVTK* _obj = nullptr;
        /**
         * @brief 网格管理器（包含全部网格数据）
         * @author liuyun
         * @date 2025-01-10
         */
        Interface::FITKMeshVTKManagerFASTSIM* _manager = nullptr;
        /**
         * @brief  ui
         * @author liuyun
         * @date   2025-01-10
         */
        Ui::MeshAssemblyDialog* _ui = nullptr;
    };
}

#endif // MESHASSEMBLYDIALOG_H
